import React, { useState, useEffect } from 'react';
import { listDeployment } from 'services/deployment';
import { defaultRejectHandler } from 'utils/http';
import Table from './table/Table';

export default function Microservice() {
  const [msList, setMsList] = useState([]);

  useEffect(() => {
    listDeployment().then(setMsList, defaultRejectHandler);
  }, []);

  const updateDeploymentList = () => listDeployment().then(setMsList, defaultRejectHandler);

  return (
    <Table dataSource={msList} updateData={updateDeploymentList} />
  );
}
